foreach

Section: Tcl Built-In Commands (n)
Updated:
Index Return to Main Contents
 

NAME

foreach - Iterate over all elements in a list  

SYNOPSIS

foreach varname list body

 

DESCRIPTION

In this command varname is the name of a variable, list is a list of values to assign to varname, and body is a Tcl script. For each element of list (in order from left to right), foreach assigns the contents of the field to varname as if the lindex command had been used to extract the field, then calls the Tcl interpreter to execute body. The break and continue statements may be invoked inside body, with the same effect as in the for command. Foreach returns an empty string.

 

KEYWORDS

foreach, iteration, list, looping


 

Index

NAME
SYNOPSIS
DESCRIPTION
KEYWORDS

This document was created by man2html, using the manual pages.
Time: 17:24:09 GMT, November 26, 2024